package com.msdemo.goods.util;

import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

/**
* @comments
* @author zg
* @date 2018年3月23日
*/
@Configuration
public class ServiceInfoUtil implements ApplicationListener<EmbeddedServletContainerInitializedEvent>{
	
	private static EmbeddedServletContainerInitializedEvent event;
	
	public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
		ServiceInfoUtil.event = event;
	}

	public static int getPort() {
        int port = event.getEmbeddedServletContainer().getPort();
        return port;
    }
	
}
